#pragma once
#include <XServerClient.h>
#include <map>
namespace xmsg{class XMsgHead;}
class XServiceProxyClient:public XServerClient{
public:
    // 设置对象在关闭时不会自动删除，以确保资源的显式管理
    XServiceProxyClient();
    void readCB(xmsg::XMsgHead* head,XMsg *msg) override;

    bool SendMsg(xmsg::XMsgHead *head, XMsg *message,XMsgEvent* ev);
    
    void RegEvent(XMsgEvent* ev);
    void DelEvent(XMsgEvent* ev);
private:
    //消息转发的对象，一个proxy对应一个XMsgEvent
    //long long:指针
    std::map<long long,XMsgEvent*> callback_task_;
    std::mutex callback_task_mutex_;
};